<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<jsp:include page="header.jsp"/>

<body>

<jsp:include page="sidebar.jsp"/>

<div style="float: left;">

<form action="DocumentSearch" method="post">
<table>
	<tr>
		<td>Query: </td>
		<td><input type='text' name='query'
			value='${requestScope.query.value}'></td>
	</tr>
	<tr>
		<td>Index:</td>
		<td>
			<input type="radio" name='indexType' value='B + Tree' checked="checked">B + Tree</input><br />
			<input type="radio" name='indexType' value='Signature File'>Signature File</input>
		</td>
	</tr>
	<tr>
		<td><input type='submit' name='submit' value='Get Documents' /></td>
		<td><input type='reset' name='clean' /></td>
	</tr>
</table>

<br /><br />

    <c:choose>
        <c:when test="${requestScope.query.documents != null && !empty requestScope.query.documents}"> 
			<table border="1" cellpadding="4">
				<thead>
					<tr>
						<th>Id</th>
						<th>Title</th>
					</tr>
				</thead>
				<tbody>
			
					<c:forEach var="document" items="${requestScope.query.documents}">
			
						<tr>
							<td>${document.id}</td>
							<td><a href='DocumentSearch?submit=show&docID=${document.id}'>${document.title}</a></td>
						</tr>
			
					</c:forEach>
			
				</tbody>
			</table>
			
		</c:when>
        <c:otherwise>
            <font color='red'>${requestScope.query.message}</font>
        </c:otherwise>
    </c:choose>

</form>

</div>

</body>

<br/>

<div>
	<jsp:include page="footer.jsp"/>
</div>

</html>